import Vue from "vue";
import Router from "vue-router";
import Login from "@/view/Login";
import Home from "@/view/Home";
import Activity from "@/view/activity/Activity";
import Swiper from "@/view/swiper/Swiper";
import Dictionary from "@/view/dic/Dictionary";
import Article from "@/view/life/Article";
import ArticleInfo from "@/view/life/modules/ArticleInfo";
import User from "@/view/user/User";
import Pet from "@/view/pet/Pet";

Vue.use(Router);

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};
export default new Router({
  routes: [
    {
      path: "/",
      name: "Login",
      component: Login,
      hidden: true,
    },
    {
      path: "/home",
      name: "Home",
      component: Home,
      hidden: true,
      children: [
        {
          path: "/activity",
          name: "Activity",
          component: Activity,
          hidden: true,
        },
        {
          path: "/swiper",
          name: "Swiper",
          component: Swiper,
          hidden: true,
        },
        {
          path: "/pet",
          name: "Pet",
          component: Pet,
          hidden: true,
        },
        {
          path: "/dictionary",
          name: "Dictionary",
          component: Dictionary,
          hidden: true,
        },
        {
          path: "/user",
          name: "User",
          component: User,
          hidden: true,
        },
        {
          path: "/articleInfo",
          name: "ArticleInfo",
          component: ArticleInfo,
        },
        {
          path: "/article",
          name: "Article",
          component: Article,
          children: [],
        },
      ],
    },
  ],
});
